public class code5_2 {
    //dp[n] = dp[n-1] + dp[n-2] + dp[n-3]
    public int climbStairs123(int n) {
        int[] dp = new int[n+1];
        dp[0] = 1;//什么都不做也是一种方案
        for (int i = 1; i <= n; i++) {
            dp[i] += (i-1 >=0 ? dp[i-1] : 0);
            dp[i] += (i-2 >=0 ? dp[i-2] : 0);
            dp[i] += (i-3 >=0 ? dp[i-3] : 0);
        }
        return dp[n];
    }
}
